package thread;

public class Demo17 {
    public static void main(String[] args) throws InterruptedException {
        Object locker = new Object();
        Thread t1 = new Thread(()->{
           System.out.println("开始wait等待");
            try {
                synchronized(locker) {
                    locker.wait();
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("等待结束");
        });
       /* Thread t2 = new Thread(()->{
            synchronized (locker){
                locker.notify();
            }
        });*/
        t1.start();
        Thread.sleep(5000);
        synchronized(locker){
            locker.notify();
        }
    }
}
